In the pandas tutorial, it starts with importing pandas.io.data. It caused an error and when I searched about it said to replace pandas.io.data with pandas_datareader. Now as I use pandas_datareader , I get an error
My code:-
import pandas as pd import datetime import pandas_datareader.data as web start=datetime.datetime(2010,1,1) end=datetime.datetime(2015,8,22) df=web.DataReader('XOM','yahoo',start,end) print(df)
Error:-
Traceback (most recent call last): File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:/Users/SAMADDAR/PycharmProjects/DataScience/pandas.py", line 1, in <module> import pandas as pd File "C:UsersSAMADDARPycharmProjectsDataSciencepandas.py", line 3, in <module> import pandas_datareader.data as web File "C:Python34libsite-packagespandas_datareader__init__.py", line 3, in <module> from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma, # noqa File "C:Python34libsite-packagespandas_datareaderdata.py", line 7, in <module> from pandas_datareader.google.daily import GoogleDailyReader File "C:Python34libsite-packagespandas_datareadergoogledaily.py", line 1, in <module> from pandas_datareader.base import _DailyBaseReader File "C:Python34libsite-packagespandas_datareaderbase.py", line 7, in <module> import pandas.compat as compat ImportError: No module named 'pandas.compat'; 'pandas' is not a package
You must be logged in to post. Please login or register an account.
Check if you have pandas installed or not.
import sys 'pandas' in sys.modules
If true, then try to change 'yahoo' with 'google'.
Also, use
import pandas_datareader as web
by avoiding 'pandas_datareader.data'
-Anakin773 7 years ago
Last edited 7 years ago
You must be logged in to post. Please login or register an account.